import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:myapp/app/modules/movelist/views/move_list_view.dart';
import 'package:myapp/app/widget/home_bar.dart';
import 'package:myapp/app/widget/tab_bar_layout.dart';

import '../controllers/movie_controller.dart';

class MovieView extends StatefulWidget {
  @override
  _MovieViewState createState() => _MovieViewState();
}

class _MovieViewState extends State<MovieView>
    with AutomaticKeepAliveClientMixin<MovieView> {
  @override
  Widget build(BuildContext context) {
    super.build(context);
    return GetBuilder<MovieController>(
      builder: (controller) {
        return controller.tabs.isEmpty
            ? Container()
            : TabBarLayout(
                controller.tabs,
                (index) {
                  return MoveListView(index);
                },
                appBar: HomeBar(),
              );
      },
      init: MovieController(),
    );
  }

  @override
  bool get wantKeepAlive => true;
}
